package core.genetic.selection;

import java.util.Random;

import core.genetic.Individual;
import core.genetic.Population;

public class TournamentSelection implements Selection
{

	@Override
	public void select(Population pop, double[] values)
	{
		//TODO: dovrsiti
	}

	private Individual tournament(Population pop, double[] values)
	{
		Random r = utility.Utils.random;
		Individual[] inds = new Individual[3];
		double[] fitness = new double[3];

		int max = 0;
		for (int i = 0; i < 3; i++)
		{
			int j = r.nextInt();
			inds[i] = pop.get(j);
			fitness[i] = values[j];
			if (fitness[i] > fitness[max])
				max = i;
		}

		return inds[max];
	}

}
